<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<link rel="stylesheet" href="./../assets/css/combined.css">
	<link rel="shortcut icon" href="./../favicon.ico" />
	<script src="http://www.google.com/jsapi" type="text/javascript"></script>
	<script type="text/javascript">
		var path = './../';
		var class_prefix = "Arr::";
	</script>
	<script src="./../assets/js/combined.js"></script>
	<title>Arr - Classes - FuelPHP Documentation</title>
</head>
<body>
	<div id="container">
		<header id="header">
			<div class="table">
				<h1>
					<strong>FuelPHP, a PHP 5.3 Framework</strong>
					Documentation
				</h1>

				<form id="google_search">
					<p>
						<span id="search_clear">&nbsp;</span>
						<input type="submit" name="search_submit" id="search_submit" value="search" />
						<input type="text" value="" id="search_input" name="search_input" />
					</p>
				</form>
			</div>
			<nav>

				<div class="clear"></div>
			</nav>
			<a href="#" id="toc_handle">table of contents</a>
			<div class="clear"></div>
		</header>

		<div id="cse">
			<div id="cse_point"></div>
			<div id="cse_content"></div>
		</div>

		<div id="main">

			<h2>Arr Class</h2>

			<p>The arr class is a set of helper functions for working with arrays.</p>

			<article>
				<h4 class="method" id="method_is_multi">is_multi($arr, $all_keys = false)</h4>
				<p>The <strong>is_multi</strong> method checks if the array passed is multi-dimensional array or not.</p>
				<table class="method">
					<tbody>
					<tr>
						<th class="legend">Static</th>
						<td>Yes</td>
					</tr>
					<tr>
						<th>Parameters</th>
						<td>
							<table class="parameters">
								<tr>
									<th>Param</th>
									<th>Default</th>
									<th class="description">Description</th>
								</tr>
								<tr>
									<th><kbd>$arr</kbd></th>
									<td><em>required</em></td>
									<td>The array to check.</td>
								</tr>
								<tr>
									<th><kbd>$all_keys</kbd></th>
									<td>
										<pre class="php"><span class="keyword">false</span></pre>
									</td>
									<td>Check that all elements are arrays.</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<th>Returns</th>
						<td>bool</td>
					</tr>
					<tr>
						<th>Example</th>
						<td>
							<pre class="php"><code>// Single array
$arr = array('one' => 1, 'two' => 2);
echo Arr::is_multi($arr);
// Result: false

// Multi-dimensional array
$arr = array('one' => array('test' => 1), 'two' => array('test' => 2), 'three' => array('test' => 3));
echo Arr::is_multi($arr);
// Result: true

// Multi-dimensional array with elements check
$arr = array('one' => array('test' => 1), 'two' => array('test' => 2), 'three' => 3);

echo Arr::is_multi($arr, false); // Result: true
echo Arr::is_multi($arr, true);  // Result: false
</code></pre>
						</td>
					</tr>
					</tbody>
				</table>
			</article>

			<article>
				<h4 class="method" id="method_is_assoc">is_assoc($arr)</h4>
				<p>The <strong>is_assoc</strong> method checks if the array passed is an associative array or not.</p>
				<table class="method">
					<tbody>
					<tr>
						<th class="legend">Static</th>
						<td>Yes</td>
					</tr>
					<tr>
						<th>Parameters</th>
						<td>
							<table class="parameters">
								<tr>
									<th>Param</th>
									<th>Default</th>
									<th class="description">Description</th>
								</tr>
								<tr>
									<th><kbd>$arr</kbd></th>
									<td><em>required</em></td>
									<td>The array to check.</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<th>Returns</th>
						<td>bool</td>
					</tr>
					<tr>
						<th>Example</th>
						<td>
							<pre class="php"><code>$arr = array('foo', 'bar', 'baz', 'yay');
echo Arr::is_assoc($arr);
// Result: false

$arr = array('foo' => 'foo', 'bar' => 'bar', 'baz' => 'baz', 'yay' => 'yay');
echo Arr::is_assoc($arr);
// Result: true

/*
 * Note that even if the '2' is defined as a string, PHP will store this internally
 * as an integer, and therefore this is NOT seen as an assoc array!
 */
$arr = array(0 => 'foo', 1 => 'bar', '2' => 'baz', 3 => 'yay');
echo Arr::is_assoc($arr);
// Result: false!
</code></pre>
						</td>
					</tr>
					</tbody>
				</table>
			</article>

			<article>
				<h4 class="method" id="method_to_assoc">to_assoc($arr)</h4>
				<p>The <strong>to_assoc</strong> method turns a non-associative array into an associative array if it has an even number of segments.</p>
				<table class="method">
					<tbody>
					<tr>
						<th class="legend">Static</th>
						<td>Yes</td>
					</tr>
					<tr>
						<th>Parameters</th>
						<td>
							<table class="parameters">
								<tr>
									<th>Param</th>
									<th>Default</th>
									<th class="description">Description</th>
								</tr>
								<tr>
									<th><kbd>$arr</kbd></th>
									<td><em>required</em></td>
									<td>The array to convert.</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<th>Returns</th>
						<td>array|null</td>
					</tr>
					<tr>
						<th>Throws</th>
						<td><kbd>BadMethodCallException</kbd> when the number of values in the given array is
							uneven</td>
					</tr>
					<tr>
						<th>Example</th>
						<td>
							<pre class="php"><code>$arr = array('foo', 'bar', 'baz', 'yay');
print_r(Arr::to_assoc($arr));

// Result:
Array
(
    ["foo"] => 'bar'
    ["baz"] => 'yay'
)

$arr = array('foo', 'bar', 'baz');
echo Arr::to_assoc($arr);
// Result: null
</code></pre>
						</td>
					</tr>
					</tbody>
				</table>
			</article>

			<article>
				<h4 id="method_assoc_to_keyval" class="method">assoc_to_keyval($assoc = null, $key_field = null, $val_field = null)</h4>
				<p>The <strong>assoc_to_keyval</strong> method turns a multi-dimensional array into a key=>val array.</p>
				<table class="method">
					<tbody>
					<tr>
						<th class="legend">Static</th>
						<td>Yes</td>
					</tr>
					<tr>
						<th>Parameters</th>
						<td>
							<table class="parameters">
								<tr>
									<th>Param</th>
									<th>Default</th>
									<th class="description">Description</th>
								</tr>
								<tr>
									<th><kbd>$assoc</kbd></th>
									<td><em>required</em></td>
									<td>The array to transform.</td>
								</tr>
								<tr>
									<th><kbd>$key_field</kbd></th>
									<td><em>required</em></td>
									<td>The associative array field to map as the key.</td>
								</tr>
								<tr>
									<th><kbd>$val_field</kbd></th>
									<td><em>required</em></td>
									<td>The associative array field to map as the value.</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<th>Returns</th>
						<td>array</td>
					</tr>
					<tr>
						<th>Throws</th>
						<td><kbd>InvalidArgumentException</kbd> when the first argument isn't an array or doesn't
							implement the Iterator interface.</td>
					</tr>
					<tr>
						<th>Example</th>
						<td>
							<pre class="php"><code>$people = array(
	array(
		"name" => "Jack",
		"age" => 21
	),
	array(
		"name" => "Jill",
		"age" => 23
	)
);

print_r(Arr::assoc_to_keyval($people, 'name', 'age'));

// Result:
Array
(
	["Jack"] => 21
	["Jill"] => 23
)
</code></pre>
						</td>
					</tr>
					</tbody>
				</table>
			</article>

			<article>
				<h4 id="method_average" class="method">average($array = null)</h4>
				<p>The <strong>average</strong> method takes all values of an array and returns the average value.</p>
				<table class="method">
					<tbody>
					<tr>
						<th class="legend">Static</th>
						<td>Yes</td>
					</tr>
					<tr>
						<th>Parameters</th>
						<td>
							<table class="parameters">
								<tr>
									<th>Param</th>
									<th>Default</th>
									<th class="description">Description</th>
								</tr>
								<tr>
									<th><kbd>$array</kbd></th>
									<td><em>required</em></td>
									<td>Array of values to average.</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<th>Returns</th>
						<td>array</td>
					</tr>
					<tr>
						<th>Example</th>
						<td>
							<pre class="php"><code>echo Arr::average(array('1', 2, 4, '8'));
// Result: 3.75</code></pre>
						</td>
					</tr>
					</tbody>
				</table>
			</article>

			<article>
				<h4 id="method_flatten" class="method">flatten($array, $glue = ':', $reset = true)</h4>
				<p>The <strong>flatten</strong> method flattens a multi-dimensional array (both associative and indexed) down into a 1 dimensional array.</p>
				<table class="method">
					<tbody>
					<tr>
						<th class="legend">Static</th>
						<td>Yes</td>
					</tr>
					<tr>
						<th>Parameters</th>
						<td>
							<table class="parameters">
								<tr>
									<th>Param</th>
									<th>Default</th>
									<th class="description">Description</th>
								</tr>
								<tr>
									<th><kbd>$array</kbd></th>
									<td><em>required</em></td>
									<td>The array to flatten.</td>
								</tr>
								<tr>
									<th><kbd>$glue</kbd></th>
									<td><pre class="php"><code>:</code></pre></td>
									<td>The string used to glue the keys together with</td>
								</tr>
								<tr>
									<th><kbd>$reset</kbd></th>
									<td><pre class="php"><code>true</code></pre></td>
									<td>Should we create a new array of values instead of merging them into the last array created by <strong>flatten</strong>?</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<th>Returns</th>
						<td>array</td>
					</tr>
					<tr>
						<th>Example</th>
						<td>
							<pre class="php"><code>$indexed = array(
	array("a"),
	array("b"),
	array("c"),
);

print_r(Arr::flatten($indexed, '_'));

// Result:
Array
(
	[0_0] => a
	[0_1] => b
	[0_2] => c
)</code></pre>
						</td>
					</tr>
					</tbody>
				</table>
			</article>

			<article>
				<h4 id="method_flatten_assoc" class="method">flatten_assoc($array, $glue = ':', $reset = true)</h4>
				<p>The <strong>flatten_assoc</strong> method flattens a multi-dimensional associative array down into a 1 dimensional associative array.</p>
				<table class="method">
					<tbody>
					<tr>
						<th class="legend">Static</th>
						<td>Yes</td>
					</tr>
					<tr>
						<th>Parameters</th>
						<td>
							<table class="parameters">
								<tr>
									<th>Param</th>
									<th>Default</th>
									<th class="description">Description</th>
								</tr>
								<tr>
									<th><kbd>$array</kbd></th>
									<td><em>required</em></td>
									<td>The array to flatten.</td>
								</tr>
								<tr>
									<th><kbd>$glue</kbd></th>
									<td><pre class="php"><code>:</code></pre></td>
									<td>The string used to glue the keys together with</td>
								</tr>
								<tr>
									<th><kbd>$reset</kbd></th>
									<td><pre class="php"><code>true</code></pre></td>
									<td>Should we create a new array of values instead of merging them into the last array created by <strong>flatten_assoc</strong>?</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<th>Returns</th>
						<td>array</td>
					</tr>
					<tr>
						<th>Example</th>
						<td>
							<pre class="php"><code>$people = array(
	array(
		"name" => "Jack",
		"age"  => 21
	),
	array(
		"name" => "Jill",
		"age"  => 23
	)
);

print_r(Arr::flatten_assoc($people));

// Result:
Array
(
	[0:name] => Jack
	[0:age]  => 21
	[1:name] => Jill
	[1:age]  => 23
)

// Let's flatten another array on top
print_r(Arr::flatten_assoc(array(array("name" => "Humpty", "age" => 11)), ":", false));

// Result:
Array
(
	[0:name] => Humpty
	[0:age]  => 11
	[1:name] => Jill
	[1:age]  => 23
)
</code></pre>
						</td>
					</tr>
					</tbody>
				</table>
			</article>

			<article>
				<h4 id="method_reverse_flatten" class="method">reverse_flatten($array, $glue = ':')</h4>
				<p>The <strong>reverse_flatten</strong> method unflattens a flattened multi-dimensional array (both associative and indexed) into its original form.</p>
				<table class="method">
					<tbody>
					<tr>
						<th class="legend">Static</th>
						<td>Yes</td>
					</tr>
					<tr>
						<th>Parameters</th>
						<td>
							<table class="parameters">
								<tr>
									<th>Param</th>
									<th>Default</th>
									<th class="description">Description</th>
								</tr>
								<tr>
									<th><kbd>$array</kbd></th>
									<td><em>required</em></td>
									<td>The array to unflatten.</td>
								</tr>
								<tr>
									<th><kbd>$glue</kbd></th>
									<td><pre class="php"><code>:</code></pre></td>
									<td>The string used to glue the keys together with</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<th>Returns</th>
						<td>array</td>
					</tr>
					<tr>
						<th>Example</th>
						<td>
							<pre class="php"><code>$flattened = array(
	'0_name' => 'James',
	'0_age'  => 24,
	'1_name' => 'John',
	'1_age'  => 34,
);

print_r(Arr::reverse_flatten($flattened, '_'));

// Result:
Array
(
	[0] => Array
		(
			[name] => James
			[age]  => 24
		)

	[1] => Array
		(
			[name] => John
			[age]  => 34
		)
)</code></pre>
						</td>
					</tr>
					</tbody>
				</table>
			</article>

			<article>
				<h4 id="method_filter_prefixed" class="method">filter_prefixed($array, $prefix, $remove_prefix = true)</h4>
				<p>The <strong>filter_prefixed</strong> method filters the array on a prefix. It returns an array where the key starts with the specified prefix.</p>
				<table class="method">
					<tbody>
					<tr>
						<th class="legend">Static</th>
						<td>Yes</td>
					</tr>
					<tr>
						<th>Parameters</th>
						<td>
							<table class="parameters">
								<tr>
									<th>Param</th>
									<th>Default</th>
									<th class="description">Description</th>
								</tr>
								<tr>
									<th><kbd>$array</kbd></th>
									<td><em>required</em></td>
									<td>The array to filter.</td>
								</tr>
								<tr>
									<th><kbd>$prefix</kbd></th>
                                    <td><em>required</em></td>
									<td>The string used to filter on</td>
								</tr>
								<tr>
									<th><kbd>$remove_prefix</kbd></th>
									<td><pre class="php"><code>true</code></pre></td>
									<td>Remove or keep the prefix in the array key?</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<th>Returns</th>
						<td>array</td>
					</tr>
					<tr>
						<th>Example</th>
						<td>
							<pre class="php"><code>$arr = array(
	"user_name" => "John",
	"user_surname" => "Lastname",
	"project_name" => "Fuel",
	"project_type" => "Framework",
);

print_r(Arr::filter_prefixed($arr, "user_"));

// Result:
Array
(
	[name] => John
	[surname] => Lastname
)

// Let's keep the prefix
print_r(Arr::filter_prefixed($arr, "project_", false);

// Result:
Array
(
	[project_name] => Fuel
	[project_type] => Framework
)
</code></pre>
						</td>
					</tr>
					</tbody>
				</table>
			</article>

			<article>
				<h4 id="method_remove_prefixed" class="method">remove_prefixed($array, $prefix)</h4>
				<p>The <strong>remove_prefixed</strong> method removes values from an array if they match a given prefix.</p>
				<table class="method">
					<tbody>
					<tr>
						<th class="legend">Static</th>
						<td>Yes</td>
					</tr>
					<tr>
						<th>Parameters</th>
						<td>
							<table class="parameters">
								<tr>
									<th>Param</th>
									<th>Default</th>
									<th class="description">Description</th>
								</tr>
								<tr>
									<th><kbd>$array</kbd></th>
									<td><em>required</em></td>
									<td>The array to remove from.</td>
								</tr>
								<tr>
									<th><kbd>$prefix</kbd></th>
                                    <td><em>required</em></td>
									<td>The string used to filter on</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<th>Returns</th>
						<td>array</td>
					</tr>
					<tr>
						<th>Example</th>
						<td>
							<pre class="php"><code>$arr = array(
	"user_name" => "John",
	"user_surname" => "Lastname",
	"project_name" => "Fuel",
	"project_type" => "Framework",
);

print_r(Arr::remove_prefixed($arr, "project"));

// Result:
Array
(
	[user_name] => John
	[user_surname] => Lastname
)
</code></pre>
						</td>
					</tr>
					</tbody>
				</table>
			</article>

            <article>
                <h4 id="method_filter_suffixed" class="method">filter_suffixed($array, $suffix, $remove_suffix = true)</h4>
                <p>The <strong>filter_suffixed</strong> method filters the array on a suffix. It returns an array where the key ends with the specified suffix.</p>
                <table class="method">
                    <tbody>
                    <tr>
                        <th class="legend">Static</th>
                        <td>Yes</td>
                    </tr>
                    <tr>
                        <th>Parameters</th>
                        <td>
                            <table class="parameters">
                                <tr>
                                    <th>Param</th>
                                    <th>Default</th>
                                    <th class="description">Description</th>
                                </tr>
                                <tr>
                                    <th><kbd>$array</kbd></th>
                                    <td><em>required</em></td>
                                    <td>The array to filter.</td>
                                </tr>
                                <tr>
                                    <th><kbd>$suffix</kbd></th>
                                    <td><em>required</em></td>
                                    <td>The string used to filter on</td>
                                </tr>
                                <tr>
                                    <th><kbd>$remove_suffix</kbd></th>
                                    <td><pre class="php"><code>true</code></pre></td>
                                    <td>Remove or keep the suffix in the array key?</td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <th>Returns</th>
                        <td>array</td>
                    </tr>
                    <tr>
                        <th>Example</th>
                        <td>
							<pre class="php"><code>$arr = array(
                                "name_1" => "John",
                                "surname_1" => "Lastname",
                                "name_2" => "Ted",
                                "surname_2" => "Surname",
                                );

                                print_r(Arr::filter_suffixed($arr, "_1"));

                                // Result:
                                Array
                                (
                                [name] => John
                                [surname] => Lastname
                                )

                                // Let's keep the suffix
                                print_r(Arr::filter_suffixed($arr, "_1", false);

                                // Result:
                                Array
                                (
                                [name_1] => John
                                [surname_1] => Lastname
                                )
                            </code></pre>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </article>

            <article>
                <h4 id="method_remove_suffixed" class="method">remove_suffixed($array, $suffix)</h4>
                <p>The <strong>remove_suffixed</strong> method removes values from an array if they match a given suffix.</p>
                <table class="method">
                    <tbody>
                    <tr>
                        <th class="legend">Static</th>
                        <td>Yes</td>
                    </tr>
                    <tr>
                        <th>Parameters</th>
                        <td>
                            <table class="parameters">
                                <tr>
                                    <th>Param</th>
                                    <th>Default</th>
                                    <th class="description">Description</th>
                                </tr>
                                <tr>
                                    <th><kbd>$array</kbd></th>
                                    <td><em>required</em></td>
                                    <td>The array to remove from.</td>
                                </tr>
                                <tr>
                                    <th><kbd>$suffix</kbd></th>
                                    <td><em>required</em></td>
                                    <td>The string used to filter on</td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <th>Returns</th>
                        <td>array</td>
                    </tr>
                    <tr>
                        <th>Example</th>
                        <td>
							<pre class="php"><code>$arr = array(
                                "name_1" => "John",
                                "surname_1" => "Lastname",
                                "name_2" => "Ted",
                                "surname_2" => "Bear",
                                );

                                print_r(Arr::remove_suffixed($arr, "_1"));

                                // Result:
                                Array
                                (
                                [name_2] => Ted
                                [surname_2] => Surname
                                )
                            </code></pre>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </article>

			<article>
				<h4 id="method_filter_keys" class="method">filter_keys($array, $keys, $remove = false)</h4>
				<p>The <strong>filter_keys</strong> method filters a given array to a set of keys. It returns an array that contains only the items whose keys are in the <kbd>$keys</kbd> array. Can also remove the specified <kbd>$keys</kbd> from an array.</p>
				<table class="method">
					<tbody>
					<tr>
						<th class="legend">Static</th>
						<td>Yes</td>
					</tr>
					<tr>
						<th>Parameters</th>
						<td>
							<table class="parameters">
								<tr>
									<th>Param</th>
									<th>Default</th>
									<th class="description">Description</th>
								</tr>
								<tr>
									<th><kbd>$array</kbd></th>
									<td><em>required</em></td>
									<td>The array to filter.</td>
								</tr>
								<tr>
									<th><kbd>$keys</kbd></th>
									<td><em>required</em></td>
									<td>Array of keys to filter the above array with.</td>
								</tr>
								<tr>
									<th><kbd>$remove</kbd></th>
									<td><pre class="php"><code>false</code></pre></td>
									<td>If true, removes the <kbd>$keys</kbd> from the <kbd>$array</kbd> instead of fetching them.</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<th>Returns</th>
						<td>array</td>
					</tr>
					<tr>
						<th>Example</th>
						<td>
							<pre class="php"><code>$arr = array(
	"user_name" => "John",
	"user_surname" => "Lastname",
	"project_name" => "Fuel",
	"project_type" => "Framework",
);

print_r(Arr::filter_keys($arr, array('project_name', 'user_name')));

// Result:
Array
(
	[project_name] => Fuel
	[user_name] => John
)

// Let's remove some keys
print_r(Arr::filter_keys($arr, array('user_name', 'user_surname'), true));

// Result:
Array
(
	[project_name] => Fuel
	[project_type] => Framework
)
</code></pre>
						</td>
					</tr>
					</tbody>
				</table>
			</article>

			<article>
				<h4 id="method_filter_recursive" class="method">filter_recursive($array, $callback = null)</h4>
				<p>The <strong>filter_recursive</strong> method provides a recursive version of PHP's array_filter() function. Like it's counterpart, you can optionally pass a callback function to determine what should be filtered.</p>
				<table class="method">
					<tbody>
					<tr>
						<th class="legend">Static</th>
						<td>Yes</td>
					</tr>
					<tr>
						<th>Parameters</th>
						<td>
							<table class="parameters">
								<tr>
									<th>Param</th>
									<th>Default</th>
									<th class="description">Description</th>
								</tr>
								<tr>
									<th><kbd>$array</kbd></th>
									<td><em>required</em></td>
									<td>The array to filter.</td>
								</tr>
								<tr>
									<th><kbd>$callback</kbd></th>
									<td><pre class="php"><code>null</code></pre></td>
									<td>A valid callback that returns a boolean.</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<th>Returns</th>
						<td>array</td>
					</tr>
					<tr>
						<th>Example</th>
						<td>
							<pre class="php"><code>$arr = array(
	"user_name" => "John",
	"user_surname" => "Lastname",
	"info" => array(
		0 => array(
			"data" = "a value",
		),
		1 => array(
			"data" = "",
		),
		2 => array(
			"data" = 0,
		),
	),
);

print_r(Arr::filter_recursive($arr));

// Result:
Array
(
	[project_name] => Fuel
	[user_name] => John
	[info] => Array
	(
		[0] => Array
		(
			[data] => a value
		)
	)
)

// Let's use a callback
print_r(Arr::filter_recursive($arr, function($item){ return $item !== ""; });

// Result:
Array
(
	[project_name] => Fuel
	[user_name] => John
	[info] => Array
	(
		[0] => Array
		(
			[data] => a value
		)
		[2] => Array
		(
			[data] => 0
		)
	)
)
</code></pre>
						</td>
					</tr>
					</tbody>
				</table>
			</article>

			<article>
				<h4 id="method_subset" class="method">subset($array, $keys, $default = null)</h4>
				<p>Similar to <a href="#method_filter_keys"><strong>filter_keys</strong></a>, the <strong>subset</strong> method uses the values in <kbd>$keys</kbd> to access this array and return the associated values. The difference is that <strong>subset</strong> returns all requested keys, providing <kbd>$default</kbd> for any missing keys.</p>
				<p>This method uses <a href="#method_get"><strong>get</strong></a> and <a href="#method_set"><strong>set</strong></a> internally, so <kbd>$keys</kbd> may contain dotted notation.</p>

				<table class="method">
					<tbody>
					<tr>
						<th class="legend">Static</th>
						<td>Yes</td>
					</tr>
					<tr>
						<th>Parameters</th>
						<td>
							<table class="parameters">
								<tr>
									<th>Param</th>
									<th>Default</th>
									<th class="description">Description</th>
								</tr>
								<tr>
									<th><kbd>$array</kbd></th>
									<td><em>required</em></td>
									<td>The array to filter.</td>
								</tr>
								<tr>
									<th><kbd>$keys</kbd></th>
									<td><em>required</em></td>
									<td>Array of keys to filter the above array with.</td>
								</tr>
								<tr>
									<th><kbd>$default</kbd></th>
									<td><pre class="php"><code>null</code></pre></td>
									<td>Keys not found in <kbd>$array</kbd> are given this value instead.</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<th>Returns</th>
						<td>array</td>
					</tr>
					<tr>
						<th>Example</th>
						<td>
							<pre class="php"><code>$arr = array(
	"user" => array(
		"name" => "John",
		"surname" => "Lastname",
	),
	"project" => array(
		"name" => "Fuel",
		"type" => "Framework",
	),
);

print_r(Arr::subset($arr, array('project.name', 'user.name')));

// Result:
Array
(
 	[project] => Array
         (
			 [name] => Fuel
		 )
	[user] => Array
         (
			 [name] => John
		 )
)

print_r(Arr::subset($arr, array('project.name', 'project.manager')));

// Result:
Array
(
 	[project] => Array
         (
			 [name] => Fuel
			 [manager] =>
		 )
)

print_r(Arr::subset($arr, array('project.name', 'project.manager', 'user', 'not_provided'), 'Not Provided'));

// Result:
Array
(
 	[project] => Array
         (
			 [name] => Fuel
			 [manager] => Not Provided
		 )
 	[user] => Array
         (
			 [name] => John
			 [surname] => Lastname
		 )
	[not_provided] => Not Provided
)
</code></pre>
						</td>
					</tr>
					</tbody>
				</table>
			</article>

			<article>
				<h4 id="method_get" class="method">get($array, $key, $default = false)</h4>
				<p>The <strong>get</strong> method returns the element of the given array using dot-notation, or a default if it is not set.</p>
				<table class="method">
					<tbody>
					<tr>
						<th class="legend">Static</th>
						<td>Yes</td>
					</tr>
					<tr>
						<th>Parameters</th>
						<td>
							<table class="parameters">
								<tr>
									<th>Param</th>
									<th>Default</th>
									<th class="description">Description</th>
								</tr>
								<tr>
									<th><kbd>$array</kbd></th>
									<td><em>required</em></td>
									<td>The array to access</td>
								</tr>
								<tr>
									<th><kbd>$key</kbd></th>
									<td><em>required</em></td>
									<td>The key requested in $array. If <strong>null</strong> is passed as key, the entire array is returned.</td>
								</tr>
								<tr>
									<th><kbd>$default</kbd></th>
									<td><pre class="php"><code>false</code></pre></td>
									<td>The value to be returned if the requested key does not exist</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<th>Returns</th>
						<td>mixed. If you pass an array of keys, the return value will be an array with the result of all requested keys.</td>
					</tr>
					<tr>
						<th>Example</th>
						<td>
							<pre class="php"><code>$person = array(
	"name" => "Jack",
	"age" => "21",
	"location" => array(
		"city" => "Pittsburgh",
		"state" => "PA",
		"country" => "US"
	)
);

echo Arr::get($person, "name", "Unknown Name");
// Result: "Jack"

echo Arr::get($person, "job", "Unknown job");
// Result: "Unknown job"

// This method can also dive into arrays by using a dot to separate between keys
echo Arr::get($person, "location.city", "Unknown City");
// Result: "Pittsburgh"</code></pre>
						</td>
					</tr>
					</tbody>
				</table>
			</article>

			<article>
				<h4 id="method_set" class="method">set(&amp;$array, $key, $value = null)</h4>
				<p>The <strong>set</strong> method sets the element of the given array using dot-notation.</p>
				<p class="note"><strong>WARNING</strong>: The original array is edited by reference</p>
				<table class="method">
					<tbody>
					<tr>
						<th class="legend">Static</th>
						<td>Yes</td>
					</tr>
					<tr>
						<th>Parameters</th>
						<td>
							<table class="parameters">
								<tr>
									<th>Param</th>
									<th>Default</th>
									<th class="description">Description</th>
								</tr>
								<tr>
									<th><kbd>$array</kbd></th>
									<td><em>required</em></td>
									<td>The array to access</td>
								</tr>
								<tr>
									<th><kbd>$key</kbd></th>
									<td><em>required</em></td>
									<td>The key requested in $array. If no key is passed, or <strong>null</strong> is passed as key value, the array is unset. If you pass an array of key -> value pairs, all the values in the array will be set.</td>
								</tr>
								<tr>
									<th><kbd>$value</kbd></th>
									<td><pre class="php"><code>null</code></pre></td>
									<td>The value to be set. Ignored if $key is an array.</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<th>Returns</th>
						<td>void</td>
					</tr>
					<tr>
						<th>Example</th>
						<td>
							<pre class="php"><code>$person = array(
	"name" => "Jack",
	"age" => "21",
	"location" => array(
		"city" => "Pittsburgh",
		"state" => "PA",
		"country" => "US"
	)
);

Arr::set($person, "name", "John");
// $person['name'] is set to "John"

// This method can also dive into arrays by using a dot to separate between keys
Arr::set($person, "location.city", "Philadelphia");
// $person['location']['city'] is set to "Philadelphia"

// or set multiple values in one go
Arr::set($person, array("name" => "John", "location.city" => "Philadelphia"));</code></pre>
						</td>
					</tr>
					</tbody>
				</table>
			</article>

			<article>
				<h4 id="method_pluck" class="method">pluck($array, $key, $index = null)</h4>
				<p>The <strong>pluck</strong> method plucks values from a collection of arrays or objects.</p>
				<table class="method">
					<tbody>
					<tr>
						<th class="legend">Static</th>
						<td>Yes</td>
					</tr>
					<tr>
						<th>Parameters</th>
						<td>
							<table class="parameters">
								<tr>
									<th>Param</th>
									<th>Default</th>
									<th class="description">Description</th>
								</tr>
								<tr>
									<th><kbd>$array</kbd></th>
									<td><em>required</em></td>
									<td>The array to pluck from</td>
								</tr>
								<tr>
									<th><kbd>$key</kbd></th>
									<td><em>required</em></td>
									<td>The key to pluck from the arrays.</td>
								</tr>
								<tr>
									<th><kbd>$index</kbd></th>
									<td><pre class="php"><code>null</code></pre></td>
									<td>Optional return array index.</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<th>Returns</th>
						<td>void</td>
					</tr>
					<tr>
						<th>Example</th>
						<td>
							<pre class="php"><code>$collection = array(
	array(
		'id' => 2,
		'name' => 'Bill',
		'surname' => 'Cosby',
	),
	array(
		'id' => 5,
		'name' => 'Chris',
		'surname' => 'Rock',
	),
	array(
		'id' => 7,
		'name' => 'Bert',
		'surname' => 'Visser',
	),
);

// Get an array of id's
$ids = \Arr::pluck($collection, 'id');
// array(2, 5, 7);

// Get an array of names with the id as the index
$names = \Arr::pluck($collection, 'name', 'id');
// array(2 => 'Bill', 5 => 'Chris', 7 => 'Bert');
</code></pre>
						</td>
					</tr>
					</tbody>
				</table>
			</article>

			<article>
				<h4 id="method_delete" class="method">delete(&amp;$array, $key)</h4>
				<p>The <strong>delete</strong> method the element of the given array using dot-notation.<br />
				<u>WARNING</u>: The original array is edited by reference, only boolean success is returned</p>
				<table class="method">
					<tbody>
					<tr>
						<th class="legend">Static</th>
						<td>Yes</td>
					</tr>
					<tr>
						<th>Parameters</th>
						<td>
							<table class="parameters">
								<tr>
									<th>Param</th>
									<th>Default</th>
									<th class="description">Description</th>
								</tr>
								<tr>
									<th><kbd>$array</kbd></th>
									<td><em>required</em></td>
									<td>The array to access</td>
								</tr>
								<tr>
									<th><kbd>$key</kbd></th>
									<td><em>required</em></td>
									<td>The key requested in $array. If no key is passed, or <strong>null</strong> is passed as key value, the array is unset.</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<th>Returns</th>
						<td>mixed, <strong>true</strong> if the key was deleted, <strong>false</strong> if the key didn't exist. If you pass an array of keys, the return value will be an array with the result of all requested deletes.</td>
					</tr>
					<tr>
						<th>Example</th>
						<td>
							<pre class="php"><code>$person = array(
	"name" => "Jack",
	"age" => "21",
	"location" => array(
		"city" => "Pittsburgh",
		"state" => "PA",
		"country" => "US"
	)
);

$result = Arr::delete($person, "name");
// deleted $person['name'] from the array, returns true

// This method can also dive into arrays by using a dot to separate between keys
$result = Arr::delete($person, "location.city");
// deleted $person['location']['city'] from the array, returns true

// or delete multiple values in one go
$result = Arr::delete($person, array("name", "location.doesnotexist"));
// deleted $person['name'], returns array('name' => true, 'location.doesnotexist' => false)</code></pre>
						</td>
					</tr>
					</tbody>
				</table>
			</article>

			<article>
				<h4 id="method_insert" class="method">insert(Array &amp;$original, $value, $pos)</h4>
				<p>The <strong>insert</strong> method is mainly an array_splice alias with added error checking <br />
				<u>WARNING</u>: The original array is edited by reference, only boolean success is returned</p>
				<table class="method">
					<tbody>
					<tr>
						<th class="legend">Static</th>
						<td>Yes</td>
					</tr>
					<tr>
						<th>Parameters</th>
						<td>
							<table class="parameters">
								<tr>
									<th>Param</th>
									<th>Default</th>
									<th class="description">Description</th>
								</tr>
								<tr>
									<th><kbd>$original</kbd></th>
									<td><em>required</em></td>
									<td>The array to use</td>
								</tr>
								<tr>
									<th><kbd>$value</kbd></th>
									<td><em>required</em></td>
									<td>The value(s) to insert</td>
								</tr>
								<tr>
									<th><kbd>$pos</kbd></th>
									<td><em>required</em></td>
									<td>The numeric position at which to insert, negative to count from the end backwards</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<th>Returns</th>
						<td>boolean</td>
					</tr>
					<tr>
						<th>Example</th>
						<td>
							<pre class="php"><code>$people = array("Jack", "Jill");

// Add one value
Arr::insert($people, "Humpty", 0);
print_r($people);
// Result:
Array
(
	[0] => Humpty
	[1] => Jack
	[2] => Jill
)

// Add multiple values
Arr::insert($people, array("Hansel", "Gretel"), 1);
print_r($people);
// Result:
Array
(
	[0] => Humpty
	[1] => Hansel
	[2] => Gretel
	[3] => Jack
	[4] => Jill
)

// Add an array
Arr::insert($people, array( array("name" => "Wolf", "teeth" => "sharp")), 0);
print_r($people);

// Result:
Array
(
	[0] => Array
		(
			[name] => Wolf
			[teeth] => sharp
		)

	[1] => Humpty
	[2] => Hansel
	[3] => Gretel
	[4] => Jack
	[5] => Jill
)

</code></pre>
						</td>
					</tr>
					</tbody>
				</table>
			</article>

			<article>
				<h4 id="method_insert_assoc" class="method">insert_assoc(array &amp;$original, array $values, $pos)</h4>
				<p>The <strong>insert_assoc</strong> method inserts elements into an associative array, at the specified position.<br />
				<u>WARNING</u>: The original array is edited by reference, only boolean success is returned.</p>
				<table class="method">
					<tbody>
					<tr>
						<th class="legend">Static</th>
						<td>Yes</td>
					</tr>
					<tr>
						<th>Parameters</th>
						<td>
							<table class="parameters">
								<tr>
									<th>Param</th>
									<th>Default</th>
									<th class="description">Description</th>
								</tr>
								<tr>
									<th><kbd>$original</kbd></th>
									<td><em>required</em></td>
									<td>The array to use</td>
								</tr>
								<tr>
									<th><kbd>$values</kbd></th>
									<td><em>required</em></td>
									<td>Array with value(s) to insert</td>
								</tr>
								<tr>
									<th><kbd>$pos</kbd></th>
									<td><em>required</em></td>
									<td>
										The location in the original array where the new values should be inserted.
										If a negative value is given, the position is counted from the back of the array.</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<th>Returns</th>
						<td>boolean, true on success, false if $pos is out of bounds.</td>
					</tr>
					<tr>
						<th>Example</th>
						<td>
							<pre class="php"><code>$character = array("name" =&gt; "Jack", "surname" =&gt; "Reacher");

Arr::insert_assoc($people, array("initial" =&gt; "P.");
print_r($people);

// Result:
Array
(
	[name] =&gt; Jack
	[initial] =&gt; P.
	[surname] =&gt; Reacher
)
</code></pre>
						</td>
					</tr>
					</tbody>
				</table>
			</article>

			<article>
				<h4 id="method_insert_before_key" class="method">insert_before_key(Array &amp;$original, $value, $key)</h4>
				<p>The <strong>insert_before_key</strong> method adds an element to an array before the key specified.<br />
				<u>WARNING</u>: The original array is edited by reference, only boolean success is returned.</p>
				<table class="method">
					<tbody>
					<tr>
						<th class="legend">Static</th>
						<td>Yes</td>
					</tr>
					<tr>
						<th>Parameters</th>
						<td>
							<table class="parameters">
								<tr>
									<th>Param</th>
									<th>Default</th>
									<th class="description">Description</th>
								</tr>
								<tr>
									<th><kbd>$original</kbd></th>
									<td><em>required</em></td>
									<td>The array to use</td>
								</tr>
								<tr>
									<th><kbd>$value</kbd></th>
									<td><em>required</em></td>
									<td>The value(s) to insert</td>
								</tr>
								<tr>
									<th><kbd>$key</kbd></th>
									<td><em>required</em></td>
									<td>The key before which to insert</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<th>Returns</th>
						<td>boolean</td>
					</tr>
					<tr>
						<th>Example</th>
						<td>
							<pre class="php"><code>$people = array("Jack", "Jill");

Arr::insert_before_key($people, "Humpty", 1);
print_r($people);

// Result:
Array
(
	[0] => Jack
	[1] => Humpty
	[2] => Jill
)
</code></pre>
						</td>
					</tr>
					</tbody>
				</table>
			</article>

			<article>
				<h4 id="method_insert_after_key" class="method">insert_after_key(Array &amp;$original, $value, $key, $is_assoc = false)</h4>
				<p>The <strong>insert_after_key</strong> method adds an element to an array after the key specified <br />
				<u>WARNING</u>: The original array is edited by reference, only boolean success is returned</p>
				<table class="method">
					<tbody>
					<tr>
						<th class="legend">Static</th>
						<td>Yes</td>
					</tr>
					<tr>
						<th>Parameters</th>
						<td>
							<table class="parameters">
								<tr>
									<th>Param</th>
									<th>Default</th>
									<th class="description">Description</th>
								</tr>
								<tr>
									<th><kbd>$original</kbd></th>
									<td><em>required</em></td>
									<td>The array to use</td>
								</tr>
								<tr>
									<th><kbd>$value</kbd></th>
									<td><em>required</em></td>
									<td>The value(s) to insert</td>
								</tr>
								<tr>
									<th><kbd>$key</kbd></th>
									<td><em>required</em></td>
									<td>The key after which to insert</td>
								</tr>
								<tr>
									<th><kbd>$is_assoc</kbd></th>
									<td><pre class="php"><code>false</code></pre></td>
									<td>Whether the array is assoc</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<th>Returns</th>
						<td>boolean</td>
					</tr>
					<tr>
						<th>Example</th>
						<td>
							<pre class="php"><code>$people = array("Jack", "Jill");

Arr::insert_after_key($people, "Humpty", 1);
print_r($people);

// Result:
Array
(
	[0] => Jack
	[1] => Jill
	[2] => Humpty
)
</code></pre>
						</td>
					</tr>
					</tbody>
				</table>
			</article>

			<article>
				<h4 id="method_insert_after_value" class="method">insert_after_value(Array &amp;$original, $value, $search, $is_assoc = false)</h4>
				<p>The <strong>insert_after_value</strong> method adds an element to an array after the value specified <br />
				<u>WARNING</u>: The original array is edited by reference, only boolean success is returned</p>
				<table class="method">
					<tbody>
					<tr>
						<th class="legend">Static</th>
						<td>Yes</td>
					</tr>
					<tr>
						<th>Parameters</th>
						<td>
							<table class="parameters">
								<tr>
									<th>Param</th>
									<th>Default</th>
									<th class="description">Description</th>
								</tr>
								<tr>
									<th><kbd>$original</kbd></th>
									<td><em>required</em></td>
									<td>The array to use</td>
								</tr>
								<tr>
									<th><kbd>$value</kbd></th>
									<td><em>required</em></td>
									<td>The value(s) to insert</td>
								</tr>
								<tr>
									<th><kbd>$search</kbd></th>
									<td><em>required</em></td>
									<td>The value after which to insert</td>
								</tr>
								<tr>
									<th><kbd>$is_assoc</kbd></th>
									<td><pre class="php"><code>false</code></pre></td>
									<td>Whether the array is assoc</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<th>Returns</th>
						<td>boolean</td>
					</tr>
					<tr>
						<th>Example</th>
						<td>
							<pre class="php"><code>$people = array("Jack", "Jill");

Arr::insert_after_value($people, "Humpty", "Jack");
print_r($people);

// Result:
Array
(
	[0] => Jack
	[1] => Humpty
	[2] => Jill
)
</code></pre>
						</td>
					</tr>
					</tbody>
				</table>
			</article>

			<article>
				<h4 id="method_sort" class="method">sort($array, $key, $order = 'asc', $sort_flags = SORT_REGULAR)</h4>
				<p>The <strong>sort</strong> method sorts a multi-dimensional array by its values.</p>
				<table class="method">
					<tbody>
					<tr>
						<th class="legend">Static</th>
						<td>Yes</td>
					</tr>
					<tr>
						<th>Parameters</th>
						<td>
							<table class="parameters">
								<tr>
									<th>Param</th>
									<th>Default</th>
									<th class="description">Description</th>
								</tr>
								<tr>
									<th><kbd>$array</kbd></th>
									<td><em>required</em></td>
									<td>The array to sort</td>
								</tr>
								<tr>
									<th><kbd>$key</kbd></th>
									<td><em>required</em></td>
									<td>The key requested to sort by in $array.</td>
								</tr>
								<tr>
									<th><kbd>$order</kbd></th>
									<td><pre class="php"><code>'asc'</code></pre></td>
									<td>The order (asc or desc).</td>
								</tr>
								<tr>
									<th><kbd>$sort_flags</kbd></th>
									<td><pre class="php"><code>SORT_REGULAR</code></pre></td>
									<td>The php sort type flags (<a href="http://php.net/manual/en/function.sort.php">http://php.net/manual/en/function.sort.php</a>)</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<th>Returns</th>
						<td>mixed</td>
					</tr>
					<tr>
						<th>Example</th>
						<td>
							<pre class="php"><code>$data = array(
	array(
		'info' => array(
			'pet' => array(
				'type' => 'dog'
			)
		),
	),
	array(
		'info' => array(
			'pet' => array(
				'type' => 'fish'
			)
		),
	),
	array(
		'info' => array(
			'pet' => array(
				'type' => 'cat'
			)
		),
	),
);

$data = Arr::sort($data, 'info.pet.type');
// Result:
array(
	array(
		'info' => array(
			'pet' => array(
				'type' => 'cat'
			)
		),
	),
	array(
		'info' => array(
			'pet' => array(
				'type' => 'dog'
			)
		),
	),
	array(
		'info' => array(
			'pet' => array(
				'type' => 'fish'
			)
		),
	),
);</code></pre>
						</td>
					</tr>
					</tbody>
				</table>
			</article>

			<article>
				<h4 id="method_multisort" class="method">multisort($array, $conditions, $ignore_case = false)</h4>
				<p>The <strong>sort</strong> method sorts a multi-dimensional array by multiple values.</p>
				<table class="method">
					<tbody>
					<tr>
						<th class="legend">Static</th>
						<td>Yes</td>
					</tr>
					<tr>
						<th>Parameters</th>
						<td>
							<table class="parameters">
								<tr>
									<th>Param</th>
									<th>Default</th>
									<th class="description">Description</th>
								</tr>
								<tr>
									<th><kbd>$array</kbd></th>
									<td><em>required</em></td>
									<td>The array to sort</td>
								</tr>
								<tr>
									<th><kbd>$conditions</kbd></th>
									<td><em>required</em></td>
									<td>Array of sorting conditions.</td>
								</tr>
								<tr>
									<th><kbd>$ornire_case</kbd></th>
									<td><pre class="php"><code>false</code></pre></td>
									<td>Whether to sort case insensitive.</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<th>Returns</th>
						<td>array</td>
					</tr>
					<tr>
						<th>Example</th>
						<td>
							<pre class="php"><code>$collection = array(
	'i5' => array(
		'name' => 'Carl',
		'age' => 17,
		'points' => 30,
		'arr' => array(
			'key' => 10,
		),
	),
	'i7' => array(
		'name' => 'carl',
		'age' => 17,
		'points' => 20,
		'arr' => array(
			'key' => 10,
		),
	),
	'i2' => array(
		'name' => 'Bert',
		'age' => 20,
		'points' => 30,
		'arr' => array(
			'key' => 10,
		),
	),
);

$collection = \Arr::multisort($collection, array(
	'name' => SORT_ASC,
	'points' => array(SORT_ASC, SORT_NUMERIC),
	'age' => array(SORT_ASC, SORT_NUMERIC),
), true);
print_r($collection);

// Result
Array
(
    [i2] => Array
        (
            [name] => Bert
            [age] => 20
            [points] => 30
            [arr] => Array
                (
                    [key] => 10
                )

        )

    [i7] => Array
        (
            [name] => carl
            [age] => 17
            [points] => 20
            [arr] => Array
                (
                    [key] => 10
                )

        )

    [i5] => Array
        (
            [name] => Carl
            [age] => 17
            [points] => 30
            [arr] => Array
                (
                    [key] => 10
                )

        )
)</code></pre>
						</td>
					</tr>
					</tbody>
				</table>
			</article>

			<article>
				<h4 id="method_in_array_recursive" class="method">in_array_recursive($needle, $haystack, $strict = false)</h4>
				<p>The <strong>in_array_recursive</strong> method checks whether a value is in an array recursively.</p>
				<table class="method">
					<tbody>
					<tr>
						<th class="legend">Static</th>
						<td>Yes</td>
					</tr>
					<tr>
						<th>Parameters</th>
						<td>
							<table class="parameters">
								<tr>
									<th>Param</th>
									<th>Default</th>
									<th class="description">Description</th>
								</tr>
								<tr>
									<th><kbd>$needle</kbd></th>
									<td><em>required</em></td>
									<td>The value to search for</td>
								</tr>
								<tr>
									<th><kbd>$haystack</kbd></th>
									<td><em>required</em></td>
									<td>The array to search in.</td>
								</tr>
								<tr>
									<th><kbd>$strict</kbd></th>
									<td><pre class="php"><code>false</code></pre></td>
									<td>Whether to use == or ===.</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<th>Returns</th>
						<td>bool</td>
					</tr>
					<tr>
						<th>Example</th>
						<td>
							<pre class="php"><code>$arr = array('one' => 1, 2, 3, array(56), 87);

echo Arr::in_array_recursive('56', $arr);
// Result: true

echo Arr::in_array_recursive('87', $arr, true);
// Result: false

echo Arr::in_array_recursive(87, $arr, true);
// Result: true</code></pre>
						</td>
					</tr>
					</tbody>
				</table>
			</article>
			<article>
				<h4 id="method_merge" class="method">merge($array)</h4>
				<p>The <strong>merge</strong> method merges 2 arrays recursively, differs in 2 important ways from array_merge_recursive(): <br />
				- When there's 2 different values and not both arrays, the latter value overwrites the earlier
	 			  instead of merging both into an array<br />
	 			- Numeric keys that don't conflict aren't changed, only when a numeric key already exists is the
				  value added using array_push()</p>
				<table class="method">
					<tbody>
					<tr>
						<th class="legend">Static</th>
						<td>Yes</td>
					</tr>
					<tr>
						<th>Parameters</th>
						<td>
							<table class="parameters">
								<tr>
									<th>Param</th>
									<th>Type</th>
									<th>Default</th>
									<th class="description">Description</th>
								</tr>
								<tr>
									<th><kbd>$array</kbd></th>
									<td><em>array</em></td>
									<td><em>required</em></td>
									<td>Multiple variables all of which must be arrays</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<th>Returns</th>
						<td>array</td>
					</tr>
					<tr>
						<th>Throws</th>
						<td><kbd>InvalidArgumentException</kbd> when one of the passed arguments is no array.</td>
					</tr>
					<tr>
						<th>Example</th>
						<td>
							<pre class="php"><code>$arr1 = array(
	'one' => 1,
	2,
	3,
	array(
		56
		),
	87
);

$arr2 = array(
	27,
	90,
	array(
		'give_me' => 'bandwidth'
		),
	'90',
	'php',
);

print_r( Arr::merge($arr1, $arr2) );
// Result:
Array
(
	[one] => 1
	[0] => 2
	[1] => 3
	[2] => Array (
			[0] => 56
				)
	[3] => 87
	[4] => 27
	[5] => 90
	[6] => Array (
			[give_me] => bandwidth
				)
	[7] => 90
	[8] => php
)
</code></pre>
						</td>
					</tr>
					</tbody>
				</table>
			</article>
			<article>
				<h4 id="method_merge_assoc" class="method">merge_assoc($array)</h4>
				<p>The <strong>merge_assoc</strong> method merges 2 or more arrays recursively, differs in 2 important ways from array_merge_recursive(): <br />
				- When there's 2 different values and not both arrays, the latter value overwrites the earlier
	 			  instead of merging both into an array<br />
	 			- Numeric keys aren't changed</p>
				<table class="method">
					<tbody>
					<tr>
						<th class="legend">Static</th>
						<td>Yes</td>
					</tr>
					<tr>
						<th>Parameters</th>
						<td>
							<table class="parameters">
								<tr>
									<th>Param</th>
									<th>Type</th>
									<th>Default</th>
									<th class="description">Description</th>
								</tr>
								<tr>
									<th><kbd>$array</kbd></th>
									<td><em>array</em></td>
									<td><em>required</em></td>
									<td>Multiple variables all of which must be arrays</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<th>Returns</th>
						<td>array</td>
					</tr>
					<tr>
						<th>Throws</th>
						<td><kbd>InvalidArgumentException</kbd> when one of the passed arguments is no array.</td>
					</tr>
					<tr>
						<th>Example</th>
						<td>
							<pre class="php"><code>$arr1 = array(
	'one' => 1,
	2 => 2,
	3 => 3,
	4 => array(
		56
	),
	5=> 87
);

$arr2 = array(
	1 => 27,
	2 => 90,
	4 => array(
		'give_me' => 'bandwidth'
	),
	6 => '90',
	7 => 'php',
);

print_r( Arr::merge_assoc($arr1, $arr2) );
// Result:
Array
(
	[one] => 1
	[2] => 90
	[3] => 3
	[4] => Array (
		[0] => 56
		[give_me] => bandwidth
	)
	[5] => 87
	[1] => 27
	[6] => 90
	[7] => php
)
</code></pre>
						</td>
					</tr>
					</tbody>
				</table>
			</article>
			<article>
				<h4 id="method_search" class="method">search($array, $value, $default = null, $recursive = true, $delimiter = '.', $strict = false)</h4>
				<p>The <strong>search</strong> method searches the array for a given value and returns the corresponding key or default value.<br />
				- If $recursive is set to true, then the <strong>search</strong> method will return a delimiter-notated key using $delimiter.</p>
				<table class="method">
					<tbody>
					<tr>
						<th class="legend">Static</th>
						<td>Yes</td>
					</tr>
					<tr>
						<th>Parameters</th>
						<td>
							<table class="parameters">
								<tr>
									<th>Param</th>
									<th>Type</th>
									<th>Default</th>
									<th class="description">Description</th>
								</tr>
								<tr>
									<th><kbd>$array</kbd></th>
									<td><em>array</em></td>
									<td><em>required</em></td>
									<td>The array to search</td>
								</tr>
								<tr>
									<th><kbd>$value</kbd></th>
									<td><em>mixed</em></td>
									<td><em>required</em></td>
									<td>The searched value</td>
								</tr>
								<tr>
									<th><kbd>$default</kbd></th>
									<td><em>string</em></td>
									<td><pre class="php"><code>null</code></pre></td>
									<td>The key to be returned if the requested value does not exist</td>
								</tr>
								<tr>
									<th><kbd>$recursive</kbd></th>
									<td><em>boolean</em></td>
									<td><pre class="php"><code>true</code></pre></td>
									<td>Whether to get keys recursively</td>
								</tr>
								<tr>
									<th><kbd>$delimiter</kbd></th>
									<td><em>string</em></td>
									<td><pre class="php"><code>'.'</code></pre></td>
									<td>The delimiter when $recursive is true</td>
								</tr>
								<tr>
									<th><kbd>$strict</kbd></th>
									<td><em>bool</em></td>
									<td><pre class="php"><code>false</code></pre></td>
									<td>Do a strict comparison on key values</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<th>Returns</th>
						<td>int|string|null</td>
					</tr>
					<tr>
						<th>Throws</th>
						<td>
							<kbd>InvalidArgumentException</kbd> when first argument is not array.
							<kbd>InvalidArgumentException</kbd> $default argument is not string or int or null.
							<kbd>InvalidArgumentException</kbd> $delimiter argument is not string.
						</td>
					</tr>
					<tr>
						<th>Example</th>
						<td>
							<pre class="php"><code>$arr = array(
	'one' => 1,
	'two' => 2,
	'three' => array(
		'a' => 4,
		'b' => 'foo'
	),
	'four',
	array(
			null,
			array(
				null,
				null,
				null,
				array(
					'deep'
				)
			)
		),
);

echo Arr::search($arr, 1);
// one

echo Arr::search($arr, 'four');
// 0

var_dump(Arr::search($arr, 5));
// NULL

echo Arr::search($arr, 4, null, true);
// three.a

var_dump(Arr::search($arr, '4', null, true, '.', true));
// NULL

echo Arr::search($arr, 'deep', null, true);
// 1.1.3.0
</code></pre>
						</td>
					</tr>
					</tbody>
				</table>
			</article>

			<article>
				<h4 id="method_unique" class="method">unique($array)</h4>
				<p>
					The <strong>unique</strong> returns an array with all unique values in the source array.
					The first value matched will be kept, duplicates will be discarded. Keys will be preserved.
					This method works like <kbd>array_unique()</kbd>, but doesn't sort the array first, and
					allows you to dedup arrays that contain objects or closures.
				</p>
				<table class="method">
					<tbody>
					<tr>
						<th>Parameters</th>
						<td>
							<table class="parameters">
								<tr>
									<th>Param</th>
									<th>Type</th>
									<th>Default</th>
									<th class="description">Description</th>
								</tr>
								<tr>
									<th><kbd>$array</kbd></th>
									<td><em>array</em></td>
									<td><em>required</em></td>
									<td>the array to de-duplicate</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<th>Returns</th>
						<td>array</td>
					</tr>
					<tr>
						<th>Example</th>
						<td>
							<pre class="php"><code>$array = array(
	'val1' => 'test', 'val2' => 'test', 'val1' => 'dup',
);

// Result: array('val1' => 'test', 'val2' => 'test')
$result = Arr::unique($array);
</code></pre>
						</td>
					</tr>
					</tbody>
				</table>
			</article>

			<article>
				<h4 id="method_sum" class="method">sum($array, $key)</h4>
				<p>The <strong>sum</strong> method calculate the sum of values in an array plucked by the $key.</p>
				<table class="method">
					<tbody>
					<tr>
						<th class="legend">Static</th>
						<td>Yes</td>
					</tr>
					<tr>
						<th>Parameters</th>
						<td>
							<table class="parameters">
								<tr>
									<th>Param</th>
									<th>Type</th>
									<th>Default</th>
									<th class="description">Description</th>
								</tr>
								<tr>
									<th><kbd>$array</kbd></th>
									<td><em>array</em></td>
									<td><em>required</em></td>
									<td>the array containing the values</td>
								</tr>
								<tr>
									<th><kbd>$key</kbd></th>
									<td><em>string</em></td>
									<td><em>required</em></td>
									<td>The key to pluck from the arrays</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<th>Returns</th>
						<td>int</td>
					</tr>
					<tr>
						<th>Throws</th>
						<td><kbd>InvalidArgumentException</kbd> when one of the passed arguments is no array.</td>
					</tr>
					<tr>
						<th>Example</th>
						<td>
							<pre class="php"><code>$collection = array(
	array(
		'age' => 20,
		'name' => 'Bill',
		'scores' => array(
			'math' => 10,
		),
	),
	array(
		'age' => 25,
		'name' => 'Chris',
		'scores' => array(
			'math' => 15,
		),
	),
	array(
		'age' => 38,
		'name' => 'Bert',
		'scores' => array(
			'math' => 5,
		),
	),
);

// Calculate sum of an array of age's
$total_age = Arr::sum($collection, 'age'); // 83

// Calculate sum of an array plucked by 'scores.math'
$total_score = Arr::sum($collection, 'scores.math'); // 30
</code></pre>
						</td>
					</tr>
					</tbody>
				</table>
			</article>

			<article>
				<h4 id="method_reindex" class="method">reindex($array)</h4>
				<p>The <strong>reindex</strong> method recusively re-indexes the numeric keys of an array. It will not alter string keys.</p>
				<table class="method">
					<tbody>
					<tr>
						<th class="legend">Static</th>
						<td>Yes</td>
					</tr>
					<tr>
						<th>Parameters</th>
						<td>
							<table class="parameters">
								<tr>
									<th>Param</th>
									<th>Type</th>
									<th>Default</th>
									<th class="description">Description</th>
								</tr>
								<tr>
									<th><kbd>$array</kbd></th>
									<td><em>array</em></td>
									<td><em>required</em></td>
									<td>the array to re-index</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<th>Returns</th>
						<td>array</td>
					</tr>
					<tr>
						<th>Example</th>
						<td>
							<pre class="php"><code>$array = array(
	2 => 2,
	'three' => 3,
	5 => array(
		2 => 2,
		'three' => 3,
		5 => 5
	),
	7 => 7
);

// reindex the array
print_r( Arr::reindex($array) );
// Result:
Array
(
    [0] => 2
    [three] => 3
    [1] => Array
        (
            [0] => 2
            [three] => 3
            [1] => 5
        )

    [2] => 7
)
</code></pre>
						</td>
					</tr>
					</tbody>
				</table>
			</article>

			<article>
				<h4 id="method_previous_by_key" class="method">previous_by_key($array, $key, $get_value = false, $strict = false)</h4>
				<p>The <strong>previous_by_key</strong> method allows you to fetch the key or the value of the previous element of an array,
				 given an existing key value.
				<table class="method">
					<tbody>
					<tr>
						<th class="legend">Static</th>
						<td>Yes</td>
					</tr>
					<tr>
						<th>Parameters</th>
						<td>
							<table class="parameters">
								<tr>
									<th>Param</th>
									<th>Default</th>
									<th class="description">Description</th>
								</tr>
								<tr>
									<th><kbd>$array</kbd></th>
									<td><em>required</em></td>
									<td>The array to use</td>
								</tr>
								<tr>
									<th><kbd>$key</kbd></th>
									<td><em>required</em></td>
									<td>The current key value to use as lookup reference</td>
								</tr>
								<tr>
									<th><kbd>$get_value</kbd></th>
									<td><pre class="php"><code>false</code></pre></td>
									<td>If false, return the previous array key, if true, return its value</td>
								</tr>
								<tr>
									<th><kbd>$strict</kbd></th>
									<td><pre class="php"><code>false</code></pre></td>
									<td>Do a strict comparison on key values</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<th>Returns</th>
						<td>mixed, the returned value, null if there is no previous array element, or false if the current key does not exist.</td>
					</tr>
					<tr>
						<th>Example</th>
						<td>
							<pre class="php"><code>// array to lookup in
$arr = array(2 => 'A', 4 => '2', 6 => 'C');

// returns false, there is no key 1 in the array
$result = Arr::previous_by_key($arr, 1);

// returns null, there is no previous key
$result = Arr::previous_by_key($arr, 2);

// returns false, there is no key '2' in the array
$result = Arr::previous_by_key($arr, '2', false, true);

// returns 2, it's the key in the array before key 4
$result = Arr::previous_by_key($arr, 4);

// returns 'A', it's the value the previous key in the array points to
$result = Arr::previous_by_key($arr, 4, true);
</code></pre>
						</td>
					</tr>
					</tbody>
				</table>
			</article>

			<article>
				<h4 id="method_next_by_key" class="method">next_by_key($array, $key, $get_value = false, $strict = false)</h4>
				<p>The <strong>next_by_key</strong> method allows you to fetch the key or the value of the next element of an array,
				 given an existing key value.
				<table class="method">
					<tbody>
					<tr>
						<th class="legend">Static</th>
						<td>Yes</td>
					</tr>
					<tr>
						<th>Parameters</th>
						<td>
							<table class="parameters">
								<tr>
									<th>Param</th>
									<th>Default</th>
									<th class="description">Description</th>
								</tr>
								<tr>
									<th><kbd>$array</kbd></th>
									<td><em>required</em></td>
									<td>The array to use</td>
								</tr>
								<tr>
									<th><kbd>$key</kbd></th>
									<td><em>required</em></td>
									<td>The current key value to use as lookup reference</td>
								</tr>
								<tr>
									<th><kbd>$get_value</kbd></th>
									<td><pre class="php"><code>false</code></pre></td>
									<td>If false, return the next array key, if true, return its value</td>
								</tr>
								<tr>
									<th><kbd>$strict</kbd></th>
									<td><pre class="php"><code>false</code></pre></td>
									<td>Do a strict comparison on key values</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<th>Returns</th>
						<td>mixed, the returned value, null if there is no next array element, or false if the current key does not exist.</td>
					</tr>
					<tr>
						<th>Example</th>
						<td>
							<pre class="php"><code>// array to lookup in
$arr = array(2 => 'A', 4 => '2', 6 => 'C');

// returns false, there is no key 1 in the array
$result = Arr::next_by_key($arr, 1);

// returns null, there is no next key
$result = Arr::next_by_key($arr, 6);

// returns false, there is no key '2' in the array
$result = Arr::next_by_key($arr, '2', false, true);

// returns 6, it's the key in the array after key 4
$result = Arr::next_by_key($arr, 4);

// returns 'C', it's the value the next key in the array points to
$result = Arr::next_by_key($arr, 4, true);
</code></pre>
						</td>
					</tr>
					</tbody>
				</table>
			</article>

			<article>
				<h4 id="method_previous_by_value" class="method">previous_by_value($array, $value, $get_value = true, $strict = false)</h4>
				<p>The <strong>previous_by_value</strong> method allows you to fetch the key or the value of the previous element of an array,
				 given an existing element value.
				<table class="method">
					<tbody>
					<tr>
						<th class="legend">Static</th>
						<td>Yes</td>
					</tr>
					<tr>
						<th>Parameters</th>
						<td>
							<table class="parameters">
								<tr>
									<th>Param</th>
									<th>Default</th>
									<th class="description">Description</th>
								</tr>
								<tr>
									<th><kbd>$array</kbd></th>
									<td><em>required</em></td>
									<td>The array to use</td>
								</tr>
								<tr>
									<th><kbd>$value</kbd></th>
									<td><em>required</em></td>
									<td>The current element value to use as lookup reference</td>
								</tr>
								<tr>
									<th><kbd>$get_value</kbd></th>
									<td><pre class="php"><code>true</code></pre></td>
									<td>If false, return the previous array key, if true, return its value</td>
								</tr>
								<tr>
									<th><kbd>$strict</kbd></th>
									<td><pre class="php"><code>false</code></pre></td>
									<td>Do a strict comparison on element values</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<th>Returns</th>
						<td>mixed, the returned value, null if there is no previous array element, or false if the current value could not be found.</td>
					</tr>
					<tr>
						<th>Example</th>
						<td>
							<pre class="php"><code>// array to lookup in
$arr = array(2 => 'A', 4 => '2', 6 => 'C');

// returns false, there is no value 'Z' in the array
$result = Arr::previous_by_value($arr, 'Z');

// returns null, there is no previous value
$result = Arr::previous_by_value($arr, 'A');

// returns false, there is no value 2 in the array, only '2'
$result = Arr::previous_by_value($arr, 2, false, true);

// returns 'A', it's the value the previous key in the array points to
$result = Arr::previous_by_value($arr, '2');

// returns 2, it's the key of the previous array element
$result = Arr::previous_by_value($arr, '2', false);
</code></pre>
						</td>
					</tr>
					</tbody>
				</table>
			</article>

			<article>
				<h4 id="method_next_by_value" class="method">next_by_value($array, $value, $get_value = true, $strict = false)</h4>
				<p>The <strong>next_by_value</strong> method allows you to fetch the key or the value of the next element of an array,
				 given an existing element value.
				<table class="method">
					<tbody>
					<tr>
						<th class="legend">Static</th>
						<td>Yes</td>
					</tr>
					<tr>
						<th>Parameters</th>
						<td>
							<table class="parameters">
								<tr>
									<th>Param</th>
									<th>Default</th>
									<th class="description">Description</th>
								</tr>
								<tr>
									<th><kbd>$array</kbd></th>
									<td><em>required</em></td>
									<td>The array to use</td>
								</tr>
								<tr>
									<th><kbd>$value</kbd></th>
									<td><em>required</em></td>
									<td>The current element value to use as lookup reference</td>
								</tr>
								<tr>
									<th><kbd>$get_value</kbd></th>
									<td><pre class="php"><code>true</code></pre></td>
									<td>If false, return the next array key, if true, return its value</td>
								</tr>
								<tr>
									<th><kbd>$strict</kbd></th>
									<td><pre class="php"><code>false</code></pre></td>
									<td>Do a strict comparison on element values</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<th>Returns</th>
						<td>mixed, the returned value, null if there is no next array element, or false if the current value could not be found.</td>
					</tr>
					<tr>
						<th>Example</th>
						<td>
							<pre class="php"><code>// array to lookup in
$arr = array(2 => 'A', 4 => '2', 6 => 'C');

// returns false, there is no value 'Z' in the array
$result = Arr::next_by_value($arr, 'Z');

// returns null, there is no next value
$result = Arr::next_by_value($arr, 'C');

// returns false, there is no value 2 in the array, only '2'
$result = Arr::next_by_value($arr, 2, false, true);

// returns 'C', it's the value the next key in the array points to
$result = Arr::next_by_value($arr, '2');

// returns 6, it's the key of the next array element
$result = Arr::next_by_value($arr, '2', false);
</code></pre>
						</td>
					</tr>
					</tbody>
				</table>
				<p class="note">Note that the 'by_key' and 'by_value' methods use the return values <strong>null</strong> and <strong>false</strong> to signal error
				conditions. Therefore the array passed may not contain keys or values that are <strong>null</strong> or <strong>false</strong>.</p>
			</article>

			<h3 id="procedural_helpers">Procedural helpers</h3>

			<article>
				<h4 id="function_in_arrayi" class="method" data-class="">in_arrayi($needle, $haystack)</h4>
				<p>The <strong>in_arrayi</strong> function is a case-insensitive version of in_array.</p>
				<table class="method">
					<tbody>
					<tr>
						<th>Parameters</th>
						<td>
							<table class="parameters">
								<tr>
									<th>Param</th>
									<th>Type</th>
									<th>Default</th>
									<th class="description">Description</th>
								</tr>
								<tr>
									<th><kbd>$needle</kbd></th>
									<td><em>string</em></td>
									<td><em>required</em></td>
									<td>the value to search for</td>
								</tr>
								<tr>
									<th><kbd>$haystrack</kbd></th>
									<td><em>array</em></td>
									<td><em>required</em></td>
									<td>the array to search in</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<th>Returns</th>
						<td>bool</td>
					</tr>
					<tr>
						<th>Example</th>
						<td>
							<pre class="php"><code>echo in_arrayi('This', array('something','tHis'));
// Result: true

echo in_arrayi('Thi', array('something','tHis'));
// Result: false</code></pre>
						</td>
					</tr>
					</tbody>
				</table>
			</article>

		</div>

		<footer>
			<p>
				&copy; FuelPHP Development Team 2010-2013 - <a href="http://fuelphp.com">FuelPHP</a> is released under the MIT license.
			</p>
		</footer>
	</div>
</body>
</html>
